package com.example.searchenginebackend.exception;

import com.example.searchenginebackend.common.ErrorCode;

/**
 * 业务异常类
 * @author 米饭好好吃
 */
public class ServiceException extends RuntimeException {
    private int code;

    public ServiceException(int code, String message) {
        super(message);
        this.code = code;
    }

    public ServiceException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public int getCode() {
        return code;
    }
}
